<template>
  <div class="goods_cell" @click="lookDetail">
    <div class="goods_top">
    <div class="img_box">
      <!-- <img src="@/assets/images/goods.png" alt=""> -->
      <!-- <van-image :src="IMAGEURL + info.logo" class="img" lazy-load v-if="info.logo" /> -->
      <li-image :src="getImages(info.logo)" class="img" v-if="info.logo" :is-preview="false" :alt="`${info.name}`"></li-image>
      <van-image :src="require('@/assets/images/goods.png')" class="img" lazy-load :alt="`${info.name}`" v-else />
    </div>
    <div class="van-multi-ellipsis--l2 goods_name">{{ info.name }}</div>
  </div>
    <div class="goods_footer">
      <div class="price">
        <span class="unit">￥</span>
        <span class="num">{{ info.price }}</span>
      </div>
      <div class="total">{{ info.initAppointmentCnt }}人预定</div>
    </div>
  </div>
</template>
<script>
import config from "@/http/config";
export default {
  name: "Goods",
  props: {
    info: {
      type: Object,
      default: function () {
        return {};
      },
    },
  },
  data() {
    return {
      IMAGEURL: config.IMAGEURL,
    };
  },
  methods: {
    // 查看详情
    lookDetail() {
      let id = this.info.id;
      this.$router.push({
        path: `/goods/detail/${id}`,
      });
    },

    // 处理图片
    getImages(str) {
      if (!str) {
        return ''
      }
      let arr = str.split(',');
      let _path = arr[0]
      return _path;
    }

  },
};
</script>
<style lang="less" scoped>
@import "./index.less";
</style>